from urllib3.contrib.socks import SOCKSProxyManager

proxy = SOCKSProxyManager('socks5://localhost:1080/')
res = proxy.request('GET', 'http://httpbin.org/ip')
print(res.data)